home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
admin
/
linuxcon.000
/
linuxcon
/
linuxconf-1.6
/
misc
/
fopen.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-03-09
|
498b
|
22 lines
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "misc.h"
#include "misc.m"
/*
Open a file and print an error message if it can't be done
*/
FILE *xconf_fopen (const char *fname, const char *mode)
{
int wr_mode = strchr(mode,'w')!=NULL || strchr(mode,'a')!=NULL;;
FILE *ret = fopen (fname,mode);
if (ret == NULL){
xconf_error (MSG_U(E_CANTDO,"Can't %s file %s\n%s")
,wr_mode ? MSG_U(E_WRITE,"write") : MSG_U(E_READ,"read")
,fname,strerror(errno));
}
return ret;
}